﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Text;
using CommunitySystem.BO;
using CommunitySystemModel;

namespace CommunitySystem
{
    public class DiaoDongBO
    {

        private string ChangeTuiXD(string text)
        {
                 if (text == "男")
                {
                    return  Convert.ToDateTime(text).AddYears(60).Year + "-" +
                                  Convert.ToDateTime(text).AddYears(60).Month + "-" + Convert.ToDateTime(text).AddDays(60).Day;
                    //tuixiu12.Text =
                    //    (Convert.ToDateTime(text).AddYears(60).Year - DateTime.Today.Year).ToString();
                }
                else //if (text == "女")
                {
                    return  Convert.ToDateTime(text).AddYears(55).Year + "-" +
                              Convert.ToDateTime(text).AddYears(55).Month + "-" + Convert.ToDateTime(text).AddDays(60).Day;
                    //tuixiu12.Text =
                    //    (Convert.ToDateTime(text).AddYears(55).Year - DateTime.Today.Year).ToString();
                }  
        }
        private string ChangeTuiXDD(string text)
        {
            if (text == "男")
            {

                return  (Convert.ToDateTime(text).AddYears(60).Year - DateTime.Today.Year).ToString();
            }
            else //if (text == "女")
            {

               return   (Convert.ToDateTime(text).AddYears(55).Year - DateTime.Today.Year).ToString();
            }
        }
        public ObservableCollection<DiaoDongModel> GetDiaoDong(string OrgIDs, int id, string diaochubenqu,string niandu,string banlizhuangtai)
        {
            ObservableCollection<DiaoDongModel> rights = new ObservableCollection<DiaoDongModel>();
            string sql = "";
            sql = string.Format(@"select *,o.name NewOrgName from diaodong dd left join orgforhr o on dd.neworgid = o.id where 1=1");
            if (!string.IsNullOrEmpty(OrgIDs) && OrgIDs != "0")
                sql += "  and NewOrgID in (" + OrgIDs + ")";
            if (id != 0) sql += " and dd.id = " + id;
            if (!string.IsNullOrEmpty(diaochubenqu)) sql += " and dd.type = '" + diaochubenqu + "'";
            if (niandu != "无" && !string.IsNullOrEmpty(niandu)) sql += " and YEAR(RZQMSJ) = " + niandu;
            if (banlizhuangtai == "已办理") sql += " and Status = '审核通过'";
            if (banlizhuangtai == "办理中") sql += " and Status != '审核通过' and Status != '审核不通过'";
            if (banlizhuangtai == "审核不通过") sql += " and Status = '审核不通过'";
            sql += " order by RZQMSJ desc";
            DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(sql);
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                rights.Add(DiaoDongModel.FillEntity(dr));
            }
            return rights;
        }

        public bool AddDiaoDong(DiaoDongModel model)
        {
            string sql = string.Format(@"INSERT INTO DiaoDong
           ([EmpbasicID]
           ,[Status]
           ,[Type]
           ,[RZQMSJ]
           ,[Name]
           ,[CardNo]
           ,[Gender]
           ,[OrgName]
           ,[PositionName]
           ,[DutyName]
           ,[NewOrgID]
           ,[NewPositionName]
           ,[NewDutyName]
           ,[Birthday],NewOrgName,DutyLevel,DutyAttribute,TongYiStatus,WorkCharge,OrgID,HuiYiDate,LuYongDate,Begindate,Enddate,
ZWCCSJ,ZWSXSJ,RQBegin,RQEnd,SYQ,DiaoRuXingShi)
     VALUES
           ({0}
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}'
           ,'{6}'
           ,'{7}'
           ,'{8}'
           ,'{9}'
           ,{10}
           ,'{11}'
           ,'{12}'
           ,'{13}','{14}','{15}'
           ,'{16}','{17}','{18}',{19},'{20}','{21}','{22}','{23}','{24}','{25}','{26}','{27}','{28}','{29}')", model.EmpbasicID, model.Status, model.Type, model.RZQMSJ, model.Name, model.CardNo, model.Gender, model.OrgName
           , model.PositionName, model.DutyName, model.NewOrgID, model.NewPositionName, model.NewDutyName, model.Birthday, model.NewOrgName, model.DutyLevel,
           model.DutyAttribute, model.TongYiStatus, model.WorkCharge, model.OrgID, model.HuiYiDate, model.LuYongDate, model.Begindate, model.Enddate,
           model.ZWCCSJ, model.ZWSXSJ, model.RQBegin, model.RQEnd, model.SYQ, model.DiaoRuXingShi);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);

            return true;
        }

        public bool UpdateDiaoDong(DiaoDongModel model)
        {
            string
                sql = string.Format(@"UPDATE DiaoDong
   SET [EmpbasicID] = {0}
      ,[Status] = '{1}'
      ,[Type] = '{2}'
      ,[RZQMSJ] = '{3}'
      ,[Name] = '{4}'
      ,[CardNo] = '{5}'
      ,[Gender] = '{6}'
      ,[OrgName] = '{7}'
      ,[PositionName] = '{8}'
      ,[DutyName] = '{9}'
      ,[NewOrgID] = {10}
      ,[NewPositionName] = '{11}'
      ,[NewDutyName] = '{12}'
      ,[Birthday] = '{13}',NewOrgName = '{14}',DutyLevel = '{15}',DutyAttribute = '{16}',TongYiStatus = '{17}',WorkCharge = '{18}',OrgID = {20},HuiYiDate = '{21}',LuYongDate = '{22}',Begindate = '{23}',Enddate = '{24}'
,ZWCCSJ = '{25}',ZWSXSJ = '{26}',RQBegin = '{27}',RQEnd = '{28}',SYQ = '{29}',DiaoRuXingShi = '{30}'
 WHERE id = {19}", model.EmpbasicID, model.Status, model.Type, model.RZQMSJ, model.Name, model.CardNo, model.Gender, model.OrgName
           , model.PositionName, model.DutyName, model.NewOrgID, model.NewPositionName, model.NewDutyName, model.Birthday, model.NewOrgName, model.DutyLevel, model.DutyAttribute, model.TongYiStatus, model.WorkCharge, model.ID, model.OrgID, model.HuiYiDate, model.LuYongDate, model.Begindate, model.Enddate, model.ZWCCSJ, model.ZWSXSJ, model.RQBegin, model.RQEnd, model.SYQ, model.DiaoRuXingShi);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);

            return true;
        }

        public bool CanShenHeDiaoDong(DiaoDongModel model)
        {
            string sql =
                string.Format(@"select count(id) from Emp_BasicInfo where name = '{0}' and cardno = '{1}' and orgid = {2}",
                              model.Name, model.CardNo, model.NewOrgID);
            DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(sql);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                if (Convert.ToInt32(ds.Tables[0].Rows[0][0]) > 0)
                {
                    return false;
                }
                else return false;
            }
            else return false;
        }




        public bool ShenHeDiaoDong(int id, string status, DiaoDongModel model)
        {
            string renzhifangshi = "";
            if (model.DutyAttribute == "领导职务") renzhifangshi = "转任（领导职务）";
            if (model.DutyAttribute == "非领导职务") renzhifangshi = "转任（非领导职务）";
            string
                sql2 = string.Format(@"UPDATE DiaoDong
   SET [Status] = '{0}',LuYongDate = '{2}' WHERE id = {1}", status, id,DateTime.Today);
            if (!string.IsNullOrEmpty(sql2))
                AccessHelper.GetInstance().ExecuteNonQuery(sql2);
            if (model.Type == "调任" || model.Type == "外区调入" || model.Type == "外省市调入")
            {
                string sql = string.Format(@"insert into Emp_BasicInfo 
                        ([Name]
           ,[CardNo]
           ,[Gender]
           ,[Birthday]
           ,[OrgID]
           ,[PositionName]
           ,[EmpStatus],TuiXiuDate,JuTuiXiuDate)
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,{4}
           ,'{5}'
           ,'{6}','{7}','{8}');select @@IDENTITY;", model.Name, model.CardNo, model.Gender, model.Birthday, model.NewOrgID, model.NewPositionName, "在职", ChangeTuiXD(model.Birthday.ToString()), ChangeTuiXDD(model.Birthday.ToString()));
                DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(sql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    if (model.NewOrgID != 46 && model.NewOrgID != 47)
                    {
                        string sql3 = string.Format(@"
            INSERT INTO CheGai
           ([EmpID]
           ,[OldZhiJi]
           ,[Status]
           ,[Demo]
           ,[RelationID],keyid,type,CreateDate)
     select {0},ed.dutylevel,'未导出','{1}',{0},
case when (select count(cg.id) Cou from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='开卡表' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) > 0 then
      (select top 1 keyid from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='开卡表' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) else
      (select top 1 id + 1 from chegai order by id desc) end KeyID,'开卡表',getdate()
 from  dbo.Emp_BasicInfo emp
inner join orgforhr o on emp.orgid = o.id
     left join dbo.Emp_Duty ed on emp.id = ed.EmpbasicID and [JobStatus] = '在任'
      where emp.ID = {0}", Convert.ToInt32(ds.Tables[0].Rows[0][0]), model.Type);
                        if (!string.IsNullOrEmpty(sql3))
                            AccessHelper.GetInstance().ExecuteNonQuery(sql3);
                    }
                    string sql1 = string.Format(@"INSERT INTO Emp_Duty
           ([EmpbasicID]
           ,[DutyNo]
           ,[DutyName]
           ,[OKDate]
           ,[IsExceptionalPromotion]
           ,[JobStatus],DutyLevel,DutyAttribute,WorkCharge,ServiceMode,JobDate,RXRZWSXSJ,RZSYQ)
     VALUES
           ({0}
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}' ,'{8}' ,'{9}'  ,'{11}' ,'{12}','{13}' ,'{14}','{15}'
          );insert into Emp_Resume (EmpbasicID,BeginDate,Unit,Duty) values ({0},'{3}'
           ,'{6}'
           ,'{10}');update diaodong set EmpbasicID = {0} where id = {7}", Convert.ToInt32(ds.Tables[0].Rows[0][0]), model.NewDutyName, model.NewPositionName,
                                                                       model.RQBegin, "否", "在任", model.NewOrgName, model.ID, model.DutyLevel, model.DutyAttribute,
                                                                       model.NewPositionName + model.NewDutyName, model.WorkCharge, renzhifangshi,
                                                                       model.ZWCCSJ,model.ZWSXSJ,model.SYQ);
                    if (!string.IsNullOrEmpty(sql1))
                        AccessHelper.GetInstance().ExecuteNonQuery(sql1);

                }
            }
            if (model.Type == "区内调动")
            {
                string dutylevel = "";
                string dutyattribute = "";
                DateTime? JobDate = null;
                DateTime? RXRZWSXSJ = null;
                string chasql =
                    string.Format(
                        @"select dutylevel,dutyattribute,JobDate,RXRZWSXSJ from dbo.Emp_Duty where empbasicid = {0} and JobStatus = '在任' ",
                        model.EmpbasicID);
                DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(chasql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    dutylevel = ds.Tables[0].Rows[0][0].ToString();
                    dutyattribute = ds.Tables[0].Rows[0][1].ToString();
                    if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0][2].ToString()) && Convert.ToDateTime(ds.Tables[0].Rows[0][2]) != Convert.ToDateTime("1900-01-01"))
                        JobDate = Convert.ToDateTime(ds.Tables[0].Rows[0][2]);
                    if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0][3].ToString()) && Convert.ToDateTime(ds.Tables[0].Rows[0][3]) != Convert.ToDateTime("1900-01-01"))
                        RXRZWSXSJ = Convert.ToDateTime(ds.Tables[0].Rows[0][3]);
                }
                if (dutylevel == model.DutyLevel)
                {
                    model.JobDate = JobDate;
                }
                if (dutyattribute == model.DutyAttribute)
                {
                    model.RXRZWSXSJ = RXRZWSXSJ;
                }
                if (model.NewOrgID != 46 && model.NewOrgID != 47)
                {
                    
                    string type = "变动表";
                    if (model.OrgID == 46 || model.OrgID == 47)
                    {
                        type = "开卡表";
                    }
                    string sql4 = string.Format(@"
            INSERT INTO CheGai
           ([EmpID]
           ,[OldZhiJi]
           ,[Status]
           ,[Demo]
           ,[RelationID],keyid,type,CreateDate)
     select {0},ed.dutylevel,'未导出','{1}',{0},
case when (select count(cg.id) Cou from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='{2}' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) > 0 then
      (select top 1 keyid from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='{2}' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) else
      (select top 1 id + 1 from chegai order by id desc) end KeyID,'{2}',getdate()
 from  dbo.Emp_BasicInfo emp
inner join orgforhr o on emp.orgid = o.id
     left join dbo.Emp_Duty ed on emp.id = ed.EmpbasicID and [JobStatus] = '在任'
      where emp.ID = {0}", model.EmpbasicID, model.Type, type);
                    if (!string.IsNullOrEmpty(sql4))
                        AccessHelper.GetInstance().ExecuteNonQuery(sql4);
                }
                string sql = string.Format(@"update Emp_BasicInfo set OrgID ={0},PositionName='{1}' where id = {2};
                        update Emp_Duty set JobStatus = '不在任' where EmpbasicID = {2};
                        update Emp_Resume set enddate ='{3}'  where id = 
                                 (select top 1 id from dbo.Emp_Resume where empbasicid = {2} order by begindate desc);
                        INSERT INTO Emp_Duty
           ([EmpbasicID]
           ,[DutyNo]
           ,[DutyName]
           ,[OKDate]
           ,[IsExceptionalPromotion]
           ,[JobStatus]
           ,DutyLevel,DutyAttribute,WorkCharge,ServiceMode,JobDate,RXRZWSXSJ,RZSYQ) values ({2},'{5}','{1}','{3}','否','在任','{6}','{7}','{9}','{12}','{14}','{15}','{16}');
                        INSERT INTO Emp_Resume
           ([EmpbasicID]
           ,[BeginDate]
           ,[Unit]
           ,[Duty]) values ({2},'{3}','{4}','{8}');delete from BianZhiJieYongEmp where EmpBasicID = {2}", model.NewOrgID, model.NewPositionName, model.EmpbasicID, model.RQBegin, model.NewOrgName, model.NewDutyName,
                                                   model.DutyLevel, model.DutyAttribute, model.NewPositionName + model.NewDutyName, model.WorkCharge,
                                                   model.JobDate, model.RXRZWSXSJ, renzhifangshi, model.Type,model.ZWCCSJ,model.ZWSXSJ,model.SYQ);
                if (!string.IsNullOrEmpty(sql))
                    AccessHelper.GetInstance().ExecuteNonQuery(sql);

            }
            if (model.Type == "单位内转任")
            {
                string dutylevel = "";
                string dutyattribute = "";
                DateTime? JobDate = null;
                DateTime? RXRZWSXSJ = null;
                string chasql =
                    string.Format(
                        @"select dutylevel,dutyattribute,JobDate,RXRZWSXSJ from dbo.Emp_Duty where empbasicid = {0} and JobStatus = '在任' ",
                        model.EmpbasicID);
                DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(chasql);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    dutylevel = ds.Tables[0].Rows[0][0].ToString();
                    dutyattribute = ds.Tables[0].Rows[0][1].ToString();
                    if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0][2].ToString()) && Convert.ToDateTime(ds.Tables[0].Rows[0][2]) != Convert.ToDateTime("1900-01-01"))
                        JobDate = Convert.ToDateTime(ds.Tables[0].Rows[0][2]);
                    if (!string.IsNullOrEmpty(ds.Tables[0].Rows[0][3].ToString()) && Convert.ToDateTime(ds.Tables[0].Rows[0][3]) != Convert.ToDateTime("1900-01-01"))
                        RXRZWSXSJ = Convert.ToDateTime(ds.Tables[0].Rows[0][3]);
                }
                if (dutylevel == model.DutyLevel)
                {
                    model.JobDate = JobDate;
                }
                if (dutyattribute == model.DutyAttribute)
                {
                    model.RXRZWSXSJ = RXRZWSXSJ;
                }
                if (dutylevel != model.DutyLevel)
                {
                    if (model.NewOrgID != 46 && model.NewOrgID != 47)
                    {

                        string type = "变动表";
                        if (model.OrgID == 46 || model.OrgID == 47)
                        {
                            type = "开卡表";
                        }
                        string sql4 =
                            string.Format(
                                @"
            INSERT INTO CheGai
           ([EmpID]
           ,[OldZhiJi]
           ,[Status]
           ,[Demo]
           ,[RelationID],keyid,type,CreateDate)
     select {0},ed.dutylevel,'未导出','{1}',{0},
case when (select count(cg.id) Cou from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='{2}' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) > 0 then
      (select top 1 keyid from chegai cg inner join Emp_BasicInfo emp on cg.empid = emp.id
      where cg.status = '未导出' and type='{2}' and emp.orgid = 
      (select orgid from Emp_BasicInfo where id = {0})) else
      (select top 1 id + 1 from chegai order by id desc) end KeyID,'{2}',getdate()
 from  dbo.Emp_BasicInfo emp
inner join orgforhr o on emp.orgid = o.id
     left join dbo.Emp_Duty ed on emp.id = ed.EmpbasicID and [JobStatus] = '在任'
      where emp.ID = {0}",
                                model.EmpbasicID, model.Type, type);
                        if (!string.IsNullOrEmpty(sql4))
                            AccessHelper.GetInstance().ExecuteNonQuery(sql4);
                    }
                }
                int renqi = 0;
                if (model.Enddate != null && model.Begindate != null)
                {
                    renqi = Convert.ToDateTime(model.Enddate).Year - Convert.ToDateTime(model.Begindate).Year;
                }
                string sql = string.Format(@"update Emp_BasicInfo set OrgID ={0},PositionName='{1}' where id = {2};
                        update Emp_Duty set JobStatus = '不在任' where EmpbasicID = {2};
                        update Emp_Resume set enddate ='{3}'  where id = 
                                 (select top 1 id from dbo.Emp_Resume where empbasicid = {2} order by begindate desc);
                        INSERT INTO Emp_Duty
           ([EmpbasicID]
           ,[DutyNo]
           ,[DutyName]
           ,[OKDate]
           ,[IsExceptionalPromotion]
           ,[JobStatus]
           ,DutyLevel,DutyAttribute,WorkCharge,ServiceMode,JobDate,RXRZWSXSJ,RZSYQ) values ({2},'{5}','{1}','{3}','否','在任','{6}','{7}','{9}','{12}','{14}','{15}','{16}');
                        INSERT INTO Emp_Resume
           ([EmpbasicID]
           ,[BeginDate]
           ,[Unit]
           ,[Duty]) values ({2},'{3}','{4}','{8}');delete from BianZhiJieYongEmp where EmpBasicID = {2}", model.NewOrgID, model.NewPositionName, model.EmpbasicID, model.RQBegin, model.NewOrgName, model.NewDutyName,
                                                   model.DutyLevel, model.DutyAttribute, model.NewPositionName + model.NewDutyName, model.WorkCharge,
                                                   model.JobDate, model.RXRZWSXSJ, renzhifangshi, model.Type, model.ZWCCSJ, model.ZWSXSJ, model.SYQ,renqi);
                if (!string.IsNullOrEmpty(sql))
                    AccessHelper.GetInstance().ExecuteNonQuery(sql);

            }
            if (model.Type == "调出本区")
            {
                string sql = string.Format(@"update Emp_BasicInfo set EmpStatus ='调离本区' where id = {2};
                        update Emp_Duty set JobStatus = '不在任' where EmpbasicID = {2};
                        update Emp_Resume set enddate ='{3}'  where id = 
                                 (select top 1 id from dbo.Emp_Resume where empbasicid = {2} order by begindate desc);
                        ", model.NewOrgID, model.NewPositionName, model.EmpbasicID, DateTime.Today, model.NewOrgName, model.NewDutyName);
                if (!string.IsNullOrEmpty(sql))
                    AccessHelper.GetInstance().ExecuteNonQuery(sql);
            }
            return true;
        }
        public bool CancelShenHeDiaoDong(int id, string status)
        {
            string
                sql = string.Format(@"UPDATE DiaoDong
   SET [Status] = '{0}',[TongYiStatus] = '不同意' WHERE id = {1}", status, id);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);
            return true;
        }
        public bool TongYiDiaoDong(int id, string status)
        {
            string
                sql = string.Format(@"UPDATE DiaoDong
   SET [TongYiStatus] = '{0}' WHERE id = {1}", status, id);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);
            return true;
        }
        public bool TuiHuiShenHeDiaoDong(int id, string status, DiaoDongModel model)
        {
            string
                sql = string.Format(@"UPDATE DiaoDong
   SET [Status] = '{0}' WHERE id = {1}", status, id);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);
            return true;
        }

        public bool DeleteShenHeDiaoDong(int id)
        {
            string
                sql = string.Format(@"delete DiaoDong
    WHERE id = {0}", id);
            if (!string.IsNullOrEmpty(sql))
                AccessHelper.GetInstance().ExecuteNonQuery(sql);

            return true;
        }

        public void ChaRuRenYuanKu(DiaoDongModel model)
        {
            string sql = string.Format(@"insert into Emp_BasicInfo 
                        ([Name]
           ,[CardNo]
           ,[Gender]
           ,[Birthday]
           ,[OrgID]
           ,[PositionName]
           ,[EmpStatus])
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,{4}
           ,'{5}'
           ,'{6}');select @@IDENTITY;", model.Name, model.CardNo, model.Gender, model.Birthday, model.NewOrgID, model.NewPositionName, "在职");
            DataSet ds = AccessHelper.GetInstance().ExcuteDataSet(sql);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                string sql1 = string.Format(@"INSERT INTO Emp_Duty
           ([EmpbasicID]
           ,[DutyNo]
           ,[DutyName]
           ,[OKDate]
           ,[IsExceptionalPromotion]
           ,[JobStatus])
     VALUES
           ({0}
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}'
          );insert into Emp_Resume (EmpbasicID,BeginDate,Unit,Duty) values ({0},'{3}'
           ,'{6}'
           ,'{2}');update diaodong set EmpbasicID = {0} where id = {7}", Convert.ToInt32(ds.Tables[0].Rows[0][0]), model.NewDutyName, model.NewDutyName, DateTime.Today, "否", "在任", model.NewOrgName, model.ID);
                if (!string.IsNullOrEmpty(sql1))
                    AccessHelper.GetInstance().ExecuteNonQuery(sql1);
            }
        }
    }
}
